fix(ui): reload access rule lists when the tab is opened - #1261
Open
driin0 wants to merge 1 commit into
Open
Conversation
The black/whitelists are fetched only when the access component is first rendered, or when another rule is picked from the dropdown. Anything that changes them in between - a second session, or a plugin syncing resolved IPs into a whitelist - stays invisible until the whole page is reloaded. index.html already provides tabSwitchEventBind for exactly this, and seven other tabs use it. This registers access alongside them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What happens
Open Access Control, switch to another tab, come back: the black/whitelist tables still show what they showed the first time. Only a full page reload updates them.
Why
initBlackWhitelistTables()is called from two places inaccess.html— when the component first renders, and fromhandleSelectedAccessRuleChange(). Nothing runs it when the tab is re-opened, so anything that changed the lists in between is invisible.This shows up whenever the lists are changed outside that page: a second admin session, or a plugin keeping a whitelist in sync. In my case the entries are IPs resolved from DDNS names, so they move on their own every few minutes and the page is almost always out of date.
The change
index.htmlalready providestabSwitchEventBind, andstatus,httprp,vdir,rules,setroot,streamproxyandpluginContextWindowall register there. This addsaccessalongside them. No new mechanism.Tested
Zoraxy 3.3.3 in Docker (arm64) running with
-devagainst this branch'ssrc/web: changed a whitelisted IP from outside the page, switched to Status and back, the table showed the new value without a reload. Verified the same sequence still shows the stale value on an unpatched build.